package com.sunny.entity;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "sun_url", schema = "crawler", catalog = "")
public class SunUrlEntity {
    private long urlId;
    private Long urlHash;
    private String urlStr;
    private String comment;

    @Id
    @Column(name = "url_id")
    public long getUrlId() {
        return urlId;
    }

    public void setUrlId(long urlId) {
        this.urlId = urlId;
    }

    @Basic
    @Column(name = "url_hash")
    public Long getUrlHash() {
        return urlHash;
    }

    public void setUrlHash(Long urlHash) {
        this.urlHash = urlHash;
    }

    @Basic
    @Column(name = "url_str")
    public String getUrlStr() {
        return urlStr;
    }

    public void setUrlStr(String urlStr) {
        this.urlStr = urlStr;
    }

    @Basic
    @Column(name = "comment")
    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SunUrlEntity that = (SunUrlEntity) o;
        return urlId == that.urlId &&
                Objects.equals(urlHash, that.urlHash) &&
                Objects.equals(urlStr, that.urlStr) &&
                Objects.equals(comment, that.comment);
    }

    @Override
    public int hashCode() {
        return Objects.hash(urlId, urlHash, urlStr, comment);
    }
}
